package com.example.myapplication.network;

import com.example.myapplication.models.Banner;
import com.example.myapplication.models.Category;
import com.example.myapplication.models.Course;

import java.util.ArrayList;
import java.util.List;

public class MockApiService {

    public List<Banner> getBanners() {
        List<Banner> banners = new ArrayList<>();
        banners.add(new Banner(1, "https://picsum.photos/400/200?random=1", "Android开发入门", "", 1));
        banners.add(new Banner(2, "https://picsum.photos/400/200?random=2", "Java编程基础", "", 2));
        banners.add(new Banner(3, "https://picsum.photos/400/200?random=3", "Kotlin进阶教程", "", 3));
        banners.add(new Banner(4, "https://picsum.photos/400/200?random=4", "Flutter跨平台开发", "", 4));
        return banners;
    }

    public List<Category> getCategories() {
        List<Category> categories = new ArrayList<>();
        categories.add(new Category(1, "移动开发", android.R.drawable.ic_dialog_info, ""));
        categories.add(new Category(2, "前端开发", android.R.drawable.ic_dialog_info, ""));
        categories.add(new Category(3, "后端开发", android.R.drawable.ic_dialog_info, ""));
        categories.add(new Category(4, "数据科学", android.R.drawable.ic_dialog_info, ""));
        return categories;
    }

    public List<Course> getRecommendedCourses() {
        List<Course> courses = new ArrayList<>();
        courses.add(new Course(1, "Android开发入门", "张老师", "初级", 4.5,
                "https://picsum.photos/200/150?random=1", "Android开发基础课程", 1));
        courses.add(new Course(2, "Java编程思想", "李老师", "中级", 4.8,
                "https://picsum.photos/200/150?random=2", "Java编程深入讲解", 2));
        courses.add(new Course(3, "Kotlin实战", "王老师", "高级", 4.7,
                "https://picsum.photos/200/150?random=3", "Kotlin高级特性", 1));
        courses.add(new Course(4, "Flutter开发", "赵老师", "中级", 4.6,
                "https://picsum.photos/200/150?random=4", "Flutter跨平台开发", 1));
        return courses;
    }

    public Course getCourseDetail(int courseId) {
        // 模拟课程详情数据
        return new Course(courseId, "课程详情", "讲师", "中级", 4.5,
                "https://picsum.photos/200/150?random=" + courseId,
                "这是课程的详细描述信息", 1);
    }

    public List<Course> getCoursesByCategory(int categoryId) {
        List<Course> courses = new ArrayList<>();
        for (int i = 1; i <= 4; i++) {
            courses.add(new Course(i, "分类课程" + i, "讲师" + i, "中级", 4.0 + i * 0.1,
                    "https://picsum.photos/200/150?random=" + (categoryId * 10 + i),
                    "分类课程描述", categoryId));
        }
        return courses;
    }
}